<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    {{msg}}
    <br>
    修改MSG：<input @input="changeMeg" type="text" v-model="msg">
    修改节流(没耐心,第一个触发的算)：<input @input="changeMegThrottle" type="text" v-model="msg">
    修改防抖(有耐心,最后一个触发的算)：<input @input="changeMegDebounce" type="text" v-model="msg">
</div>
</body>
<script src="../js/http_cdn.bootcdn.net_ajax_libs_vue_2.6.6_vue.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/lodash.js/4.17.21/lodash.js"></script>
<script>
    new Vue({
        el: "#app",
        data: {
            msg: 'hello world'
        },
        methods: {
            changeMeg() {
                console.log(this.msg)
            },
            changeMegThrottle: _.throttle(function () {
                this.changeMeg()
            }, 500),
            changeMegDebounce: _.debounce(function () {
                this.changeMeg()
            }, 500),
        },
    });
</script>
</html>
